/*
 * @Description: In User Settings Edit
 * @Author: your name
 * @Date: 2019-10-15 09:36:58
 * @LastEditTime: 2019-10-19 00:34:02
 * @LastEditors: Please set LastEditors
 */
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

// 引入store仓库
import store from './vuex/store';

// import $ from 'jquery';
// import 'bootstrap3/dist/css/bootstrap.css';
// import 'bootstrap3/dist/js/bootstrap.js';
import axios from 'axios';


Vue.config.productionTip = false;

Vue.use(ElementUI);
Vue.prototype.axios = axios;

// 登录重定向
router.beforeEach((to, from, next) => {
        if (to.path === '/login') {
            sessionStorage.removeItem('user');
        }
        var user = sessionStorage.getItem('user');
        if (!user && to.path !== '/login') {
            next({
                path: '/login'
            })
        } else {
            next();
        }
    }),
    /* eslint-disable no-new */
    new Vue({
        el: '#app',
        router,
        store,
        components: { App },
        template: '<App/>'
    })